<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta charset="UTF-8">
	<title>修改门票</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    
<!-- 最新导入 -->
<script type="text/javascript" src="<c:url value='/template/new_muban/js/jquery-min-1.7.js'/>"></script>
<link rel="stylesheet" href="<c:url value='/template/new_muban/css/font.css'/>">
<link rel="stylesheet" href="<c:url value='/template/new_muban/css/xadmin.css'/>">   
<script src="<c:url value='/template/new_muban/lib/layui/layui.js'/>" charset="utf-8"></script> 
<script type="text/javascript" src="<c:url value='/template/new_muban/js/xadmin.js'/>"></script>

 <!-- 富文本编辑器 -->
<script type="text/javascript" charset="utf-8" src="<c:url value='/ue/ueditor.config.js'/>"></script>
<script type="text/javascript" charset="utf-8" src="<c:url value='/ue/ueditor.all.js'/>"> </script>



<!-- 标签 -->
<link rel="stylesheet" type="text/css" href="<c:url value='/template/lead_into/tags_input/css.css'/>" />
<script src="<c:url value='/template/lead_into/tags_input/tagsinput.js'/>" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
	/*圆形头像  */
	/* #divcss5{ margin:10px auto}  */
	#divcss5 img{ border-radius:50%} 
	.x-so input.layui-input {
    	width: 150px;
	}
	/*layui图片上传*/
	.layui-upload-img {
	    width: 92px;
	    height: 92px;
	    margin: 0 10px 10px 0;
	}
</style>


<style type="text/css">
.uploader-list {
	margin-left: -15px;
}

.uploader-list .info {
	position: relative;
	margin-top: -25px;
	background-color: black;
	color: white;
	filter: alpha(Opacity = 80);
	-moz-opacity: 0.5;
	opacity: 0.5;
	width: 100px;
	height: 25px;
	text-align: center;
	display: none;
}

.uploader-list .handle {
	position: relative;
	background-color: black;
	color: white;
	filter: alpha(Opacity = 80);
	-moz-opacity: 0.5;
	opacity: 0.5;
	width: 100px;
	text-align: right;
	height: 18px;
	margin-bottom: -18px;
	display: none;
}

.uploader-list .handle i {
	margin-right: 5px;
}

.uploader-list .handle i:hover {
	cursor: pointer;
}

.uploader-list .file-iteme {
	margin: 12px 0 0 15px;
	padding: 1px;
	float: left;
}
</style>

</head>
<body>
   
     <div class="x-body" id="x-img">
        <form class="layui-form ">
                 <input placeholder="活动一" type="hidden" name="file_url" id="file_url" value="${promotionDetails.img}" lay-verify="required">
         
        <input placeholder="推广二 " type="hidden" name="img_url" id="img_url" value="${promotionDetails.t_shareimg}" lay-verify="required" >
        
     <input placeholder="显示三 " type="hidden" name="show_url" id="show_url" value="${promotionDetails.t_show}" lay-verify="required" readonly="readonly">     
        <input type="hidden" id="t_id" value="${promotionDetails.t_id}">
          <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                  <span class="x-red">*</span>门票名称
              </label>
              <div class="layui-input-block">
                    <input type="text" id="t_name" name="t_name" placeholder="请输入门票名称" lay-verify="required"
                  value="${promotionDetails.t_name}" autocomplete="off" class="layui-input">
              </div>
          </div>
          
          
            <div class="layui-form-item layui-form-text">
              <label for="desc" class="layui-form-label">
           <span class="x-red">*</span> 门票图片
              </label>
               <div class="layui-input-inline" >
				  <button type="button" class="layui-btn" id="t_img">门票图片</button>
				  <div class="layui-upload-list">
				    <img class="layui-upload-img" id="demo1" src="${promotionDetails.img}">
				    <p id="t_demoText"></p>
				  </div>
				</div>   
           </div>
           <div class="layui-form-item layui-form-text">
              <label for="desc" class="layui-form-label">
           <span class="x-red">*</span> 推广图片
              </label>
               <div class="layui-input-inline" >
				  <button type="button" class="layui-btn" id="t_fx_img">推广图片</button>
				  <div class="layui-upload-list">
				    <img class="layui-upload-img" id="demo2" src="${promotionDetails.t_shareimg}">
				    <p id="t_fx_demoText"></p>
				  </div>
				</div>   
           </div>
          
          
       <%--    <div class="layui-form-item layui-form-text">
              <label for="desc" class="layui-form-label">
           <span class="x-red">*</span> 轮播图片
              </label>
               <div class="layui-input-inline" >
				  <button type="button" class="layui-btn" id="t_show_img">轮播图片</button>
				  <div class="layui-upload-list">
				    <img class="layui-upload-img" id="demo3" src="${promotionDetails.t_show}">
				    <p id="t_show_demoText"></p>
				  </div>
				</div>   
           </div> --%>
          
          
          
          
          <div class="layui-form-item layui-form-text">
			<label for="desc" class="layui-form-label"> 
				<span class="x-red">*</span>轮播图
			</label>
			<div class="layui-input-block">
				<div class="layui-upload">
					<button type="button" class="layui-btn" id="test2">多图上传</button>
					<blockquote class="layui-elem-quote layui-quote-nm"
						style="margin-top: 10px; width: 88%">
						预览图：
						<div class="layui-upload-list uploader-list" style="overflow: auto;"
							id="uploader-list">
							 <c:forTokens items="${promotionDetails.t_show}" delims="," var="banner">  
						         
							 <div id="" class="file-iteme">
							 <div class="handle"><i class="layui-icon layui-icon-delete"></i></div>
							 	<img style="width: 100px;height: 100px;" src="<c:out value="${banner}"/>">
									<div class="info"></div>
							</div>
						    </c:forTokens> 
	                    
							
						</div>
					</blockquote>
				</div>
			
			</div>
		</div>
          
          
          
          
          
           <div class="layui-form-item">
			    <label class="layui-form-label">套餐内门票</label>
			    <div class="layui-input-block">
			      <input type="checkbox" <c:if test="${promotionDetails.t_flag == 1}"> checked=""</c:if> name="t_flag" lay-skin="switch" lay-filter="mp_power" lay-text="ON|OFF" disabled>
			    </div>
  		  </div>
          
      
     <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
         包含门票
              </label>
              <div class="layui-input-inline" style="width:50%">
	              	<c:forEach	items="${allPromotionByFlag}" var="pf">
	                    <input type="checkbox" name="t_b_ticket" value="${pf.t_id}" title="${pf.t_name}" lay-skin="primary" 
	              		<c:forEach	items="${t_b_list}" var="t_b">
	              			<c:if test="${pf.t_id == t_b.type_id}">checked=""</c:if>
	              		</c:forEach>	
	              		<c:if test="${promotionDetails.t_flag == 1}">disabled</c:if>
	              		>
	              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${pf.t_name}</span><i class="layui-icon layui-icon-ok"></i></div>
              	</c:forEach>
              </div>
          </div>    
     <%--       <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
         包含门票
              </label>
              <div class="layui-input-inline" style="width:50%">
	              	<c:forEach	items="${allPromotionByFlag}" var="pf">
	                    <input type="checkbox" name="t_b_ticket" value="${pf.t_id}" title="${pf.t_name}" lay-skin="primary" 
	              		<c:forEach	items="${promotionDetails.t_b_ticket}" var="all_t_b_ticket">
	              			<c:if test="${pf.t_id == all_t_b_ticket}">checked=""</c:if>
	              		</c:forEach>	
	              		<c:if test="${promotionDetails.t_flag == 1}">disabled</c:if>
	              		>
	              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${pf.t_name}</span><i class="layui-icon layui-icon-ok"></i></div>
              	</c:forEach>
              </div>
          </div>  --%>
          
         <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
         包含优惠券
              </label>
              <div class="layui-input-inline" style="width:50%">
              	<c:forEach	items="${allCoupon}" var="cou">
              		
                    <input type="checkbox" name="t_b_coupon" value="${cou.c_id}" title="${cou.c_title}" lay-skin="primary" 
                    
                    <c:forEach	items="${t_b_coupon_list}" var="coupon">
	              			<c:if test="${cou.c_id == coupon.type_id}">checked=""</c:if>
	              		</c:forEach>	
	              		<c:if test="${promotionDetails.t_flag == 1}">disabled</c:if>
                    >
              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${cou.c_title}</span><i class="layui-icon layui-icon-ok"></i></div>
              		
              	</c:forEach>
              </div>
          </div> 
             
           <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
                  包含抵扣卡
              </label>
	              <div class="layui-input-inline" style="width:50%">
	              	<c:forEach	items="${findAllSmallTicket}" var="allSmallTicket">
	                    <input type="checkbox" name="smallTicket" value="${allSmallTicket.ct_id}" title="${allSmallTicket.ct_name}(截止到 : ${allSmallTicket.ct_Invalidtime})" lay-skin="primary" 
		              		<c:forEach items="${t_b_card_list}" var="card_list">
		              			<c:if test="${allSmallTicket.ct_id == card_list.type_id}">checked</c:if>
		              		</c:forEach>
	                    >
	              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${allSmallTicket.ct_name}(截止到 : ${allSmallTicket.ct_Invalidtime})</span><i class="layui-icon layui-icon-ok"></i></div>
	              		
	              	</c:forEach>
	              </div>
	              </div>
          
          
         
        <%--    <c:if test="${order_flag == 0}">
             <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
                  抵扣卡
              </label>
	              <div class="layui-input-inline" style="width:50%">
	              	<c:forEach	items="${findAllSmallTicket}" var="allSmallTicket">
	                    <input type="checkbox" name="smallTicket" value="${allSmallTicket.ct_id}" title="${allSmallTicket.ct_name}(截止到 : ${allSmallTicket.ct_Invalidtime})" lay-skin="primary" 
		              		<c:forEach items="${findBindPromotionAndSmallTicket}" var="bindSmallTicket">
		              			<c:if test="${allSmallTicket.ct_id == bindSmallTicket.ct_id}">checked</c:if>
		              		</c:forEach>
	                    >
	              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${allSmallTicket.ct_name}(截止到 : ${allSmallTicket.ct_Invalidtime})</span><i class="layui-icon layui-icon-ok"></i></div>
	              		
	              	</c:forEach>
	              </div>
	              </div>
	              
	      <div class="layui-form-item">
		              <label for="username" class="layui-form-label" >
		                 抵扣卡数量
		              </label>
		              <div class="layui-input-inline">
		              <c:forEach items="${findBindPromotionAndSmallTicket}" var="allSmallTicket" begin="0" end="0">
		                    <input type="text" id="ct_count" value="${allSmallTicket.ct_count}" name="ct_count" placeholder="不设置默认为1张" 
		                     onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
		                  autocomplete="off" class="layui-input">
		                 </c:forEach>
		              </div>
		          </div>
              </c:if> 
           <c:if test="${order_flag == 1}">
             <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
                  抵扣卡
              </label>
	              <div class="layui-input-inline" style="width:50%">
	              	<c:forEach	items="${findAllSmallTicket}" var="allSmallTicket">
	                    <input type="checkbox" name="smallTicket" value="${allSmallTicket.ct_id}" title="${allSmallTicket.ct_name}(截止到 : ${allSmallTicket.ct_Invalidtime})" lay-skin="primary" 
		              		<c:forEach items="${findBindPromotionAndSmallTicket}" var="bindSmallTicket">
		              			<c:if test="${allSmallTicket.ct_id == bindSmallTicket.ct_id}">checked </c:if>disabled
		              		</c:forEach>
	                    >
	              		
	              	</c:forEach>
	              </div>
	            </div>
		          <div class="layui-form-item">
		              <label for="username" class="layui-form-label" >
		                 抵扣卡数量
		              </label>
		              <div class="layui-input-inline">
		              <c:forEach items="${findBindPromotionAndSmallTicket}" var="allSmallTicket" begin="0" end="0">
		                    <input type="text"   id="ct_count" value="${allSmallTicket.ct_count}" name="ct_count" placeholder="不设置默认为1张" 
		                     onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
		                  autocomplete="off" class="layui-input">
		                 </c:forEach>
		              </div>
		          </div>
              </c:if> 
               --%>
          
          
          
          
          
            <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
		可选权益数量
              </label>
              <div class="layui-input-inline">
                    <input type="text" id="xz" name="xz" placeholder="0张不开启" value="${promotionDetails.xz}"
                     onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
                  autocomplete="off" class="layui-input">
              </div>
          </div>
         
           <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
         可选包含门票
              </label>
              <div class="layui-input-inline" style="width:50%">
              	<c:forEach	items="${allPromotionByFlag}" var="pf">
              		
					    <input type="checkbox" name="t_k_ticket" value="${pf.t_id}" title="${pf.t_name}" lay-skin="primary" 
	              		<c:forEach	items="${t_k_list}" var="t_k">
	              			<c:if test="${pf.t_id == t_k.type_id}">checked=""</c:if>
	              		</c:forEach>	
	              		<c:if test="${promotionDetails.t_flag == 1}">disabled</c:if>
	              		>                    



              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${pf.t_name}</span><i class="layui-icon layui-icon-ok"></i></div>
              		
              	</c:forEach>
              </div>
          </div> 
          
           <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
         可选优惠券
              </label>
              <div class="layui-input-inline" style="width:50%">
              	<c:forEach	items="${allCoupon}" var="cou">
              		
                    <input type="checkbox" name="t_k_coupon" value="${cou.c_id}" title="${cou.c_title}" lay-skin="primary" 
                    
                    <c:forEach	items="${t_k_coupon_list}" var="coupon">
	              			<c:if test="${cou.c_id == coupon.type_id}">checked=""</c:if>
	              		</c:forEach>	
	              		<c:if test="${promotionDetails.t_flag == 1}">disabled</c:if>
                    >
              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${cou.c_title}</span><i class="layui-icon layui-icon-ok"></i></div>
              		
              	</c:forEach>
              </div>
          </div> 
          
          
        <div class="layui-form-item layui-row">
              <label for="username" class="layui-form-label" >
                  可选抵扣卡
              </label>
	              <div class="layui-input-inline" style="width:50%">
	              	<c:forEach	items="${findAllSmallTicket}" var="allSmallTicket">
	                    <input type="checkbox" name="k_card_list" value="${allSmallTicket.ct_id}" title="${allSmallTicket.ct_name}(截止到 : ${allSmallTicket.ct_Invalidtime})" lay-skin="primary" 
		              		<c:forEach items="${t_k_card_list}" var="card_list">
		              			<c:if test="${allSmallTicket.ct_id == card_list.type_id}">checked</c:if>
		              		</c:forEach>
	                    >
	              		<div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>${allSmallTicket.ct_name}(截止到 : ${allSmallTicket.ct_Invalidtime})</span><i class="layui-icon layui-icon-ok"></i></div>
	              		
	              	</c:forEach>
	              </div>
	              </div>  
          
          
          
         <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                  <span class="x-red">*</span>绑定店铺 
              </label>
              <div class="layui-input-inline">
                <select name="all_shop" id="all_shop"  lay-verify="required" >
		              <option value="" >请选择要绑定的店铺</option>
		              <c:forEach items="${selectAllShop}" var="allShop">
		             
		              	<option value="${allShop.s_id}" 
		              		<c:if test="${allShop.s_id == promotionDetails.s_id}"> selected="selected" </c:if>
		              	>${allShop.s_name}</option>
		              </c:forEach>
            	</select>
              </div>
          </div>   
          
          <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                  <span class="x-red">*</span>原价
              </label>
              <div class="layui-input-inline">
                    <input type="username" id="t_sales_price"  lay-verify="required" 
                 value="${promotionDetails.t_sales_price}"  autocomplete="off" class="layui-input" placeholder="请输入原价"  onkeyup="clearNoNum(this)">
              </div>
          </div> 
  		<div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                  <span class="x-red">*</span>促销价格
              </label>
              <div class="layui-input-inline">
                    <input type="username" id="t_price"  lay-verify="required" 
                   value="${promotionDetails.t_price}" autocomplete="off" class="layui-input" placeholder="请输入促销价格"  onkeyup="clearNoNum(this)">
              </div>
          </div>
         
          <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                  <span class="x-red">*</span>结算价格
              </label>
              <div class="layui-input-inline">
                    <input type="username" id="t_js_price"  lay-verify="required" 
                   value="${promotionDetails.t_js_price}" autocomplete="off" class="layui-input" placeholder="请输入结算价格"  onkeyup="clearNoNum(this)">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                  <span class="x-red">*</span>成交推荐人佣金
              </label>
              <div class="layui-input-inline">
                    <input type="username" id="t_one"  lay-verify="required" 
                  value="${promotionDetails.t_one}" autocomplete="off" class="layui-input" placeholder="请输入成交推荐人佣金"  onkeyup="clearNoNum(this)">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                  <span class="x-red">*</span>首次推荐人一级佣金
              </label>
              <div class="layui-input-inline">
                    <input type="username" id="t_two"  lay-verify="required" 
                  value="${promotionDetails.t_two}"  autocomplete="off" class="layui-input" placeholder="请输入首次推荐人一级佣金"  onkeyup="clearNoNum(this)">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                 可报名数量
              </label>
              <div class="layui-input-inline">
              	<c:if test="${promotionDetails.t_count == -1}">
               		<input type="username" id="t_count" autocomplete="off" class="layui-input" placeholder="无限" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                </c:if>
                <c:if test="${promotionDetails.t_count != -1}">
               		<input type="username" id="t_count" autocomplete="off" value="${promotionDetails.t_count}" class="layui-input" placeholder="不设置默认为无限" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                </c:if>
              </div>
          </div>
          
           <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                 <span class="x-red">*</span>咨询电话
              </label>
              <div class="layui-input-inline">
                    <input type="username" id="t_phone" lay-verify="required"
                  autocomplete="off" class="layui-input" value="${promotionDetails.t_phone}" placeholder="请输入咨询" >
              </div>
          </div>
           <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                <span class="x-red">*</span>地址
              </label>
              <div class="layui-input-block">
                    <input type="username" id="t_address" lay-verify="required"
                  autocomplete="off" class="layui-input" value="${promotionDetails.t_address}" placeholder="请输入地址"  >
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label" >
                 <span class="x-red">*</span>简介
              </label>
              <div class="layui-input-block">
                    <input type="username" id="t_jj" lay-verify="required"
                  autocomplete="off" class="layui-input" value="${promotionDetails.t_jj}" placeholder="请输入简介"  >
              </div>
          </div>
          
          
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>开始时间
              </label>
              <div class="layui-input-inline"  >
                 <input class="layui-input"  autocomplete="off" lay-verify="required" value="<fmt:formatDate pattern="yyy-MM-dd HH:mm:ss" value="${promotionDetails.t_starttime}"/>"  placeholder="开始日" name="start" id="start" readonly>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>到期时间
              </label>
              <div class="layui-inline"  >
                 <input class="layui-input"  autocomplete="off" lay-verify="required" value="<fmt:formatDate pattern="yyy-MM-dd" value="${promotionDetails.t_endtime}"/>"  placeholder="活动截止日" name="end" id="end" readonly>
              </div>-&nbsp;
			<div class="layui-inline"  >
				<input type="text"  autocomplete="off" value="<fmt:formatDate pattern="HH:mm:ss" value="${promotionDetails.t_endtime}"/>" class="layui-input" id="end_time" placeholder="请选择时间" lay-verify="required">
              </div>
          </div>
          
           
           <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red">*</span>核销截止时间
              </label>
              <div class="layui-inline"  >
                 <input class="layui-input"  autocomplete="off" value="<fmt:formatDate pattern="yyy-MM-dd" value="${promotionDetails.t_used_time}"/>" lay-verify="required"  placeholder="核销截止日" name="use_end" id="use_end" readonly>
			</div>-&nbsp;
              <div class="layui-inline"  >
              		<input type="text"  autocomplete="off" value="<fmt:formatDate pattern="HH:mm:ss" value="${promotionDetails.t_used_time}"/>" class="layui-input" id="use_end_time" placeholder="请选择时间" lay-verify="required">
              </div>
          </div>
          
          
       
          
          
           <div class="layui-form-item layui-form-text">
              <label for="desc" class="layui-form-label">
           流程
              </label>
              <div class="layui-input-block" >
				<textarea id ="t_flow" name="" placeholder="请输入流程" class="layui-textarea">${promotionDetails.t_flow}</textarea>
              </div>
           </div>
           <div class="layui-form-item layui-form-text">
              <label for="desc" class="layui-form-label">
           须知
              </label>
              <div class="layui-input-block" >
				<%-- <textarea id ="t_info" name="" placeholder="请输入须知" class="layui-textarea">${promotionDetails.t_info}</textarea> --%>
              <script id="editor_xz" type="text/plain" style="width:100%;height:500px;">${promotionDetails.t_info}</script>
              </div>
           </div>
           
          <div class="layui-form-item layui-form-text">
              <label for="desc" class="layui-form-label">
           详情
              </label>
              <div class="layui-input-block" >
               	<script id="editor" type="text/plain" style="width:100%;height:500px;">${promotionDetails.t_desc}</script>
              </div>
           </div> 
           
           
           
          <div class="layui-form-item" id="upload_show" ><!--  style="display: none;" -->
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="add" lay-submit="">
                 修改
              </button>
          </div>
      </form>
    </div>
    <script>
    

    //时间
    layui.use('laydate', function(){
      var laydate = layui.laydate;
      
      //执行一个laydate实例
      laydate.render({
        elem: '#start' //指定元素
        	,trigger: 'click'
      });

      //执行一个laydate实例
      laydate.render({
        elem: '#end' //指定元素
        	,trigger: 'click'
      });
      //执行一个laydate实例
      laydate.render({
    	  type: 'time'
    		    ,format: 'HH:mm:ss'
        ,elem: '#end_time' //指定元素
        	,trigger: 'click'
      });
      //执行一个laydate实例
      laydate.render({
        elem: '#use_end' //指定元素
        	,trigger: 'click'
      });
      //执行一个laydate实例
      laydate.render({
    	  type: 'time'
    		    ,format: 'HH:mm:ss'
        ,elem: '#use_end_time' //指定元素
        	,trigger: 'click'
      });
      
    });
  
    
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
        
          
      //    var cond = true;
          //监听switch开关
    /*     form.on('switch(power)', function(data){
    	 // console.log(data.elem); //得到checkbox原始DOM对象
    	  console.log(data.elem.checked); //开关是否开启，true或者false
    	 // console.log(data.value); //开关value值，也可以通过data.elem.value得到
    	 // console.log(data.othis); //得到美化后的DOM对象
    	 	cond = data.elem.checked;
    	 //	alert(cond);
    	 	
    	 });   */
          
          
          
          
          //监听提交
          form.on('submit(add)', function(data){
            console.log(data);
          //活动id
            var t_id = $("#t_id").val(); 
          //活动名称
          var t_name = $("#t_name").val();
       //   alert("图片路径     :  "+file_url);
        //促销价格
          var t_price = $("#t_price").val();
          //原价
          var t_sales_price = $("#t_sales_price").val();
        //影友会价格
          var t_js_price = $("#t_js_price").val();
        //一级佣金
          var t_one = $("#t_one").val();
        //二级佣金
          var t_two = $("#t_two").val();
          //报名数量
          var t_count = $("#t_count").val();
          //开始时间
          var t_starttime = $("#start").val();
          //到期时间
          var t_endtime = $("#end").val();
          var end_time = $("#end_time").val();
          t_endtime = t_endtime+" "+end_time;
        //活动详情
        var t_desc = UE.getEditor('editor').getContent();
        //活动流程
        var t_flow = $("#t_flow").val();
        //活动须知
        //var t_info = $("#t_info").val();
        
      //活动须知
    	 var t_info = UE.getEditor('editor_xz').getContent();
    	//var t_info = $("#t_info").val();
    	if(t_info == "" || t_info == null){
     	  layer.msg('请输入须知!',{icon: 2,time:3000});      
	      	  return false; 
	      } 
	    	if(t_desc == "" || t_desc == null){
	     	  layer.msg('请输入详情!',{icon: 2,time:3000});      
		      	  return false; 
	      } 
        
        
        
        //活动电话
        var t_phone = $("#t_phone").val();
        //活动地址
        var t_address = $("#t_address").val();
        //活动简介
        var t_jj = $("#t_jj").val();
      	//活动图片
     	var img = $("#file_url").val();
     	//推广图片
     	var t_shareimg = $("#img_url").val();
     	//显示图片
     	//var t_show = $("#show_url").val();
     		var t_show = images.toString();
     	  //核销截止时间
        var t_used_time = $("#use_end").val();
     //   alert(t_used_time)
     //   alert($("#use_end_time").val());
        //截止时间
         var use_end_time = $("#use_end_time").val();
         t_used_time = t_used_time+" "+use_end_time;
     	//抵扣卡数量
     	
        var ct_count = $("#ct_count").val();
     	if(ct_count == '' ||ct_count == null){
     		ct_count = 1;	
     	}
     	//店铺id
     	var shop_id = $("#all_shop").val();
     	
     	
        if(t_count == ''){
        	t_count = -1;
        }
        if(t_endtime < t_starttime){
        	layer.msg('结束日期不能小于开始日期!',{icon: 2,time:3000});      
        	return false;
        }
        
        
        var checkbox_smallTicket = $("input:checkbox[name='smallTicket']:checked").map(function(index,elem) {
            return $(elem).val();
        }).get().join(',');
        //alert("选中的checkbox的值为："+checkbox_smallTicket);
       var checkbox_b_ticket = $("input:checkbox[name='t_b_ticket']:checked").map(function(index,elem) {
          return $(elem).val();
      }).get().join(',');
            
       var checkbox_b_coupon = $("input:checkbox[name='t_b_coupon']:checked").map(function(index,elem) {
           return $(elem).val();
       }).get().join(',');
       
       console.log(checkbox_b_ticket);
       
       
       var checkbox_k_ticket = $("input:checkbox[name='t_k_ticket']:checked").map(function(index,elem) {
           return $(elem).val();
       }).get().join(',');
       
       var checkbox_k_coupon = $("input:checkbox[name='t_k_coupon']:checked").map(function(index,elem) {
           return $(elem).val();
       }).get().join(',');
       var checkbox_k_card = $("input:checkbox[name='k_card_list']:checked").map(function(index,elem) {
           return $(elem).val();
       }).get().join(',');
       
       
      var xz = 0;
      if($("#xz").val() == null || $("#xz").val() == ""){
     	 xz = 0;
      }else if($("#xz").val() < 0){
     	 xz = 0;
      }else{
     	 xz = $("#xz").val(); 
     	 
      }
      if(xz == 0){
     	 checkbox_k_ticket = "";
     	checkbox_k_coupon = "";
     	checkbox_k_card = "";
      }
       
    /*   console.log("xz : "+xz);
      console.log("checkbox_k_ticket : "+checkbox_k_ticket); */
      var flag = "${promotionDetails.flag}";
      
      if(flag == 1){
    	  checkbox_b_ticket = "";
       	  checkbox_b_coupon = "";
       	  checkbox_smallTicket = "";
      		xz = 0;
      		checkbox_k_ticket = "";
      		checkbox_k_coupon = "";
      		checkbox_k_card = "";
      }
       
      
      console.log("t_show : "+t_show);
      
     // return false;
          //发异步，把数据提交给php
           $.ajax({
               type: "POST",
               async : false, // 注意此处需要yi步  
               url:  "<c:url value='/updatePromotionDetails.do'/>",//"t_sales_price":t_sales_price
               data: {"t_id":t_id,"t_name":t_name,"t_price":t_price,"t_sales_price":t_sales_price
            	   ,"t_js_price":t_js_price,"t_one":t_one,"t_two":t_two,"t_count":t_count,"t_starttime":t_starttime
            	   ,"t_endtime":t_endtime,"t_desc":t_desc,"t_flow":t_flow,"t_info":t_info,"t_b_card":checkbox_smallTicket,"t_phone":t_phone,"t_address":t_address,"t_jj":t_jj,"t_shareimg":t_shareimg,"img":img,"t_show":t_show,"t_used_time":t_used_time
            		,"shop_id":shop_id,"t_count":t_count,"t_b_ticket":checkbox_b_ticket,"t_b_coupon":checkbox_b_coupon
            		,"t_k_ticket":checkbox_k_ticket,"xz":xz,"t_k_coupon":checkbox_k_coupon,"t_k_card":checkbox_k_card
               },
               success: function(data){
                   if (data == 0) {
                	   layer.msg('修改失败!',{icon: 2,time:3000});      
                       return false;
                   } else  {
                	   layer.msg("修改成功", {icon: 6,time:500},function () {
                           // 获得frame索引
                           var index = parent.layer.getFrameIndex(window.name);
                           //alert(index);
                           //关闭当前frame
                           parent.layer.close(index);
                           //重新加载父页面
                           parent.location.reload();
                       });
		           } 
              }
	        });   
          
        
         	//禁止页面自动跳转
            return false;
          });
        });
        
        
        
        
        
        
        <!-- 图片弹出层 -->
        layui.use('layer', function(){
            $ = layui.jquery;//jquery
          layer = layui.layer;//弹出层

          //以上模块根据需要引入
        	//轮播图弹出
            layer.ready(function(){ //为了layer.ext.js加载完毕再执行
              layer.photos({
                photos: '#x-img'
                //,shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
              });
            });

        });     
            
    </script>
    
    
  <script>
		
    $('#easyContainer').easyUpload({
      allowFileTypes: '*.jpg;*.png',//允许上传文件类型，格式';*.doc;*.pdf'
      allowFileSize: 1*1024,//允许上传文件大小(KB)
      selectText: '选择图片',//选择文件按钮文案
      multi: false,//是否允许多文件上传
      multiNum: 1,//多文件上传时允许的文件数
      showNote: true,//是否展示文件上传说明
      note: '提示：图片最大支持1M，支持格式为jpg、png,最佳尺寸720*270,请耐心等待上传完成!',//文件上传说明    提示：最多上传5个文件，支持格式为doc、docx、pdf、jpg、png、mp4
      showPreview: true,//是否显示文件预览
      url: '<%=request.getContextPath()%>/toQiNiu.do',//上传文件地址
      fileName: 'file',//文件filename配置参数
     /*  formParam: {
        token: $.cookie('token_cookie')//不需要验证token时可以去掉
      }, */
      //formParam：文件filename以外的配置参数，格式：{key1:value1,key2:value2}
   /*    formParam:{
    	  o_order_id : $(".ziz").val()
      }, */
      timeout: 30000,//请求超时时间
      okCode: 200,//与后端返回数据code值一致时执行成功回调，不配置默认200
     // datatype:'json',
      successFunc: function(res) {
    	 // alert(res);
        console.log('成功回调', res.type);
        
        $("#file_url").val(res.file_url);
     //   layer.msg("上传成功", {icon: 6,time:2000});
      //  alert("上传成功");
     //   $("#upload_show").css('display','block');//显示
      },//上传成功回调函数
      errorFunc: function(res) {
    	  layer.msg("上传失败", {icon: 2,time:2000});
    	 //alert("上传失败");
    	           
    	  //alert(res.okCode);
        //console.log('失败回调', res);
      },//上传失败回调函数
      deleteFunc: function(res) {
        console.log('删除回调', res);
      }//删除文件回调函数
    });
    
    
    
    
  
  </script>
  <!-- 标签input -->
<script type="text/javascript">
function getinput(){
	alert($('#tagsinputval').val());
}     
</script>    
<!-- 小数验证 -->
<script type="text/javascript">
//小数验证
function clearNoNum(obj){  
    //修复第一个字符是小数点 的情况.  
    if(obj.value !=''&& obj.value.substr(0,1) == '.'){  
        obj.value="";  
    }  
    obj.value = obj.value.replace(/^0*(0\.|[1-9])/, '$1');//解决 粘贴不生效  
    obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符  
    obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的       
    obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");      
    obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数       
    if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额  
        if(obj.value.substr(0,1) == '0' && obj.value.length == 2){  
            obj.value= obj.value.substr(1,obj.value.length);      
        }  
    }      
}      
  

</script>
<!-- ue初始化 -->
<!-- ue初始化 -->
		<script type="text/javascript">
		var ue = UE.getEditor('editor',{
			autoFloatEnabled:true,//浮动
			toolbars: [[
	    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
	           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
	            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 
	        ]]
		});
		
		 var ue2 = UE.getEditor('editor_xz',{
			autoFloatEnabled:true,//浮动
			toolbars: [[
	    		'source','bold', 'italic',  'removeformat', 'formatmatch', 'autotypeset','selectall', 'cleardoc', 
	           'lineheight', '|','fontfamily', 'fontsize', 'forecolor', 'backcolor','|',
	            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','insertimage', 'emotion', 
	        ]]
		});
			
			
		</script>
		 <script>
		
		//多图容器 【注册全局变量】
		 var sss = "${promotionDetails.t_show}";
		 //var stringResult = 
		 var images = sss.split(',');
  
  
  //layui上传
  layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload;
  
  //活动图片上传
  var uploadInst = upload.render({
    elem: '#t_img'
    	,size: 1024//限制文件大小，单位 KB
    	 ,exts: 'jpg|png'
    ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code != 200){
        return layer.msg('上传失败');
      }
      //上传成功
      $("#file_url").val(res.file_url);
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#t_demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  
 
  
  //推广图片上传
 upload.render({
    elem: '#t_fx_img'
    	,size: 1024//限制文件大小，单位 KB
    	 ,exts: 'jpg|png'
    ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo2').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
    	//如果上传失败
        if(res.code != 200){
          return layer.msg('上传失败');
        }
        //上传成功
        $("#img_url").val(res.file_url);
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#t_fx_demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  
  
//看看就行，具体内容demo里面有，缺陷，后台必须根据layui格式返回，可看具体layui文档。
 
	  
 upload.render({
	 elem: '#t_show_img'
		 ,size: 1024//限制文件大小，单位 KB
		 ,exts: 'jpg|png'
		    ,url: '<%=request.getContextPath()%>/uploadToQiNiu.do'
		    ,before: function(obj){
		      //预读本地文件示例，不支持ie8
		      obj.preview(function(index, file, result){
		        $('#demo3').attr('src', result); //图片链接（base64）
		      });
		    }
		    ,done: function(res){
		      //如果上传失败
		      if(res.code != 200){
		        return layer.msg('上传失败');
		      }
		      //上传成功
		      $("#show_url").val(res.file_url);
		    }
		    ,error: function(){
		      //演示失败状态，并实现重传
		      var demoText = $('#t_show_demoText');
		      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
		      demoText.find('.demo-reload').on('click', function(){
		        uploadInst.upload();
		      });
		    }
		 });
	 
 
 
 
 
//多图片上传
	upload.render({
		elem: '#test2'
      ,url: "<c:url value='/uploadToQiNiu.do'/>"
      ,multiple: true
      ,before: function(obj){
          layer.msg('图片上传中...', {
              icon: 16,
              shade: 0.01,
              time: 0
          })
      }
      ,done: function(res){
      	//console.log(res);
      	//console.log(res.file_url);
          layer.close(layer.msg());//关闭上传提示窗口
          var title = res.file_url;
          var i1 = title.lastIndexOf("_"); //3
          title = title.substr(i1 +1);
          
          if ($(".file-iteme").length >=5) {
      		return layer.msg('上传图片不能多于5张！');
				  }else{
					  
	                //上传完毕
	                $('#uploader-list').append(
	                    '<div id="" class="file-iteme">' +
	                    '<div class="handle"><i class="layui-icon layui-icon-delete"></i></div>' +
	                    '<img style="width: 100px;height: 100px;" src='+ res.file_url +'>' +
	                    '<div class="info">' + title + '</div>' +
	                    '</div>'
	                    
	                );
	                  //追加图片成功追加文件名至图片容器
	                    images.push(res.file_url);
				 }
          
      }
	});
 
  
 });   
  
  
  
  
  
  $(document).on("mouseenter mouseleave", ".file-iteme", function(event){
	    if(event.type === "mouseenter"){
	        //鼠标悬浮
	        $(this).children(".info").fadeIn("fast");
	        $(this).children(".handle").fadeIn("fast");
	    }else if(event.type === "mouseleave") {
	        //鼠标离开
	        $(this).children(".info").hide();
	        $(this).children(".handle").hide();
	    }
	});

	//删除图片
	$(document).on("click", ".file-iteme .handle", function(event){
	    
	    var  $this = $(this).parent();   //  习惯性保存下当前标签
	    var index = $this.index();
	    console.info( index );
	    
	    
	    $(this).parent().remove();
		  console.log(images);
	  //获取下标
		//var subscript=$("#uploader-list img").index($(this));  
		//console.log("下标  :  "+subscript);
		//删除数组
		images.splice(index, 1);
		//重新排序
		//images.sort();
	    console.log(images);
	    
	});
     
  </script>
      
  </body>
</html>